<?php
/*
 * Copyright 2008 by Oliver Radwan, Maxwell Palmer, Nolan McNair,
 * Taylor Talmage, and Allen Tucker.  This program is part of RMH Homebase.
 * RMH Homebase is free software.  It comes with absolutely no warranty.
 * You can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation
 * (see <http://www.gnu.org/licenses/ for more information).
*/

/**
 * Person class for RMH homebase.
 * @author Oliver Radwan and Allen Tucker
 * @version May 1, 2008, modified for RMH Delaware 2/15/2011
 */

class Person {
	private $id; 		 // id (unique key) = first_name . phone1
	private $first_name; // first name as a string
	private $last_name;  // last name as a string
	private $address; 	 // address - string
	private $city; 		 // city - string
	private $state; 	 // state - string
	private $zip; 		 // zip code - integer
	private $phone1; 	 // main phone
	private $phone2; 	 // alternate phone
    private $email; 	 // email address as a string
	private $type;       // array of "Rec", "Fam", "Van", "Kit", "Off",
	                     // "Lin","Chr","Dup", "App", "trainee", "teen", "sub", "committee", "manager"
    private $status;     // a person may be "active", "LOA", "former"
	private $occupation; // current occupation
	private $references;   // App: names and phones of up to 2 references 
	private $maywecontact; // "yes" or "no" for permission to contact references
	private $motivation;   // App: why interested in RMH?
	private $specialties;  // App: special interests and hobbies related to RMH

	private $availability; // array of day-time pairs; e.g., Mon9-12
	private $schedule;     // array of scheduled shifts; e.g.,  OneMon9-12
	private $history; 	   // array of recent shifts worked; e.g., 03-12-089-12
	private $birthday;     // format: 03-12-08
	private $start_date;   // format: 03-12-08

	private $notes;        // notes that only the manager can see and edit
	private $password;     // password for calendar and database access: default = $id

	/**
	 * constructor for all persons
	 */
	function __construct($f, $l, $a, $c, $s, $z, $p1, $p2, $e, $t, $st, $oc, $re, $mwc,
	                     $mot, $spe,
                         $av, $sch, $hist, $bd, $sd,
	                     $notes, $pass){
		$this->id = $f . $p1;
		$this->first_name = $f;
		$this->last_name = $l;
		$this->address = $a;
		$this->city = $c;
		$this->state = $s;
		$this->zip = $z;
		$this->phone1 = $p1;
		$this->phone2 = $p2;
		$this->email = $e;
		if ($t !== "")
		   $this->type = array($t);
		else $this->type = array();
		$this->status = $st;
		$this->occupation = $oc;
		$this->references = $re;
		if ($re != null) 
		   $this->maywecontact = "yes";
		$this->motivation = $mot;
		$this->specialties = $spe;
		if ($av !== "")
		   $this->availability = array($av);
		else $this->availability = array();
		if ($sch !== "")
		   $this->schedule = array($sch);
		else $this->schedule = array();
		if ($hist !== "")
		   $this->history = array($hist);
		else $this->history = array();

		$this->birthday = $bd;
		$this->start_date = $sd;
		$this->notes = $notes;
		$this->password = $pass;  // default password == $id
		if($this->id==$this->password) 
		    $this->password = md5($this->id);
	}

	function get_id(){
		return $this->id;
	}
    function get_first_name(){
		return $this->first_name;
	}
    function get_last_name(){
		return $this->last_name;
	}
    function get_address(){
		return $this->address;
	}
    function get_city(){
		return $this->city;
	}
    function get_state(){
		return $this->state;
	}
	function get_zip(){
		return $this->zip;
	}
	function get_phone1(){
		return $this->phone1;
	}
	function get_phone2(){
		return $this->phone2;
	}
    function get_email(){
		return $this->email;
	}
	/**
	 * @return type of person, an array of: "Rec", Fam", "Van", etc.
	 */
	function get_type(){
		return $this->type;
	}
	function get_status(){
		return $this->status;
	}
	function get_occupation(){
		return $this->occupation;
	}
	function get_references(){
		return $this->references;
	}
	function get_maywecontact(){
		return $this->maywecontact;
	}
    function get_motivation() {
		return $this->motivation;
	}
	function get_specialties() {
		return $this->specialties;
	}
	function get_availability(){
		return $this->availability;
	}
	function get_schedule(){
		return $this->schedule;
	}
	function get_history(){
		return $this->history;
	}
	function get_birthday(){
		return $this->birthday;
	}
	function get_start_date(){
		return $this->start_date;
	}
    function get_notes(){
		return $this->notes;
	}
    function get_password(){
		return $this->password;
	}
 }

?>
